<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<%@page import="org.edu.system.DBConnect"%>
<%
	String stu_id = (String) (session.getAttribute("UserName"));
	String sql = "SELECT * FROM student WHERE stu_id = '" + stu_id + "'";
	System.out.println(sql);

	Connection con = DBConnect.getCon();
	Statement stmt = null;
	ResultSet rs = null;
	stmt = con.createStatement();
	rs = stmt.executeQuery(sql);//执行命令
	if (rs.next())// 如果记录集非空，表明有匹配的用户ID
	{

		//正常进行
	} else {
		// 否则登录失败
		// response.sendRedirect ( "MyJsp.jsp" );
		response.sendRedirect("login_failure.jsp");
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="resultBean" class="mybean.selectBean" scope="request"/>
<html>
<head>
<link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学生后台系统 - 查课表</title>
</head>
<body style="width:900px; margin:0 auto;">
<br>
<div>
<table border="1" class="table table-striped table-bordered">
      <tr>
		<th>课程 </th>
  		<th>时间 </th>
  		<th>星期 </th>
  		<th>地点 </th>
  		<th>老师 </th>
  		<th>学分 </th>
  </tr>
      	<tr>
  <%  String [][] record = resultBean.getTableRecord();
      for(int i=0;i<record.length;i++) {
  %>
  <%     for(int j=0;j<record[i].length;j++) {
  %>        <td><%= record[i][j] %> </td>
  <%     }
  %>    </tr>
  <%  }
  %>
  </table>
 </div>
</font></body>
</html>